function InvitCoupon(params){ 
	 
}

InvitCoupon.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new InvitCoupon.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new InvitCoupon.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new InvitCoupon.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.id=function(id){if(this.proxy)return this.getProxy().id(id);  this.put("id", id);return this;};
	/** and id is null */
	this.idNull=function(){if(this.proxy)return this.getProxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
	/** not .... */
	this.idNot=function(){if(this.proxy)return this.getProxy().idNot();this.put("idNot", "not");return this;};
	this.idNotNull=function(){if(this.proxy)return this.getProxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
	this.idNot=function(id){if(this.proxy)return this.getProxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
		
	/** and id <= ? */
	this.idMin=function(min){if(this.proxy)return this.getProxy().idMin(min);this.put("idMin", min);return this;};
	/** and id >= ? */
	this.idMax=function(max){if(this.proxy)return this.getProxy().idMax(max);this.put("idMax", max);return this;};
		
		
	this.idIn=function(ids){
		if(this.proxy)return this.getProxy().idIn(ids);  this.put("idIn", ids);return this;
	};	
		 
	
	
	/** 所属品牌 [非空] [Merchant]      **/
	this.merchant=function(merchant){if(this.proxy)return this.getProxy().merchant(merchant);  this.put("merchant", merchant);return this;};
	/** and merchant is null */
	this.merchantNull=function(){if(this.proxy)return this.getProxy().merchantNull();if(this.get("merchantNot")==null)this.put("merchantNot", "");this.put("merchant", null);return this;};
	/** not .... */
	this.merchantNot=function(){if(this.proxy)return this.getProxy().merchantNot();this.put("merchantNot", "not");return this;};
	this.merchantNotNull=function(){if(this.proxy)return this.getProxy().merchantNotNull();this.put("merchantNot", "not");this.put("merchant", null);return this;};
	this.merchantNot=function(merchant){if(this.proxy)return this.getProxy().merchantNot(merchant);this.put("merchantNot", "not");this.put("merchant", merchant);return this;};
		
		
	this.merchantIn=function(ids){
		if(this.proxy)return this.getProxy().merchantIn(ids);  this.put("merchantIn", ids);return this;
	};	
		 
	
	
	/** 适用商品 [非空] [Commodity]      **/
	this.commodity=function(commodity){if(this.proxy)return this.getProxy().commodity(commodity);  this.put("commodity", commodity);return this;};
	/** and commodity is null */
	this.commodityNull=function(){if(this.proxy)return this.getProxy().commodityNull();if(this.get("commodityNot")==null)this.put("commodityNot", "");this.put("commodity", null);return this;};
	/** not .... */
	this.commodityNot=function(){if(this.proxy)return this.getProxy().commodityNot();this.put("commodityNot", "not");return this;};
	this.commodityNotNull=function(){if(this.proxy)return this.getProxy().commodityNotNull();this.put("commodityNot", "not");this.put("commodity", null);return this;};
	this.commodityNot=function(commodity){if(this.proxy)return this.getProxy().commodityNot(commodity);this.put("commodityNot", "not");this.put("commodity", commodity);return this;};
		
		
	this.commodityIn=function(ids){
		if(this.proxy)return this.getProxy().commodityIn(ids);  this.put("commodityIn", ids);return this;
	};	
		 
	
	
	/** 推荐人折扣 [非空]    最大设9.9折 不能大于等于10  也不能为负数   **/
	this.recomDiscount=function(recomDiscount){if(this.proxy)return this.getProxy().recomDiscount(recomDiscount);  this.put("recomDiscount", recomDiscount);return this;};
	/** and recom_discount is null */
	this.recomDiscountNull=function(){if(this.proxy)return this.getProxy().recomDiscountNull();if(this.get("recomDiscountNot")==null)this.put("recomDiscountNot", "");this.put("recomDiscount", null);return this;};
	/** not .... */
	this.recomDiscountNot=function(){if(this.proxy)return this.getProxy().recomDiscountNot();this.put("recomDiscountNot", "not");return this;};
	this.recomDiscountNotNull=function(){if(this.proxy)return this.getProxy().recomDiscountNotNull();this.put("recomDiscountNot", "not");this.put("recomDiscount", null);return this;};
	this.recomDiscountNot=function(recomDiscount){if(this.proxy)return this.getProxy().recomDiscountNot(recomDiscount);this.put("recomDiscountNot", "not");this.put("recomDiscount", recomDiscount);return this;};
		
	/** and recom_discount <= ? */
	this.recomDiscountMin=function(min){if(this.proxy)return this.getProxy().recomDiscountMin(min);this.put("recomDiscountMin", min);return this;};
	/** and recom_discount >= ? */
	this.recomDiscountMax=function(max){if(this.proxy)return this.getProxy().recomDiscountMax(max);this.put("recomDiscountMax", max);return this;};
		
		 
	
	
	/** 老客户折扣        **/
	this.invitcOldDiscount=function(invitcOldDiscount){if(this.proxy)return this.getProxy().invitcOldDiscount(invitcOldDiscount);  this.put("invitcOldDiscount", invitcOldDiscount);return this;};
	/** and invitc_old_discount is null */
	this.invitcOldDiscountNull=function(){if(this.proxy)return this.getProxy().invitcOldDiscountNull();if(this.get("invitcOldDiscountNot")==null)this.put("invitcOldDiscountNot", "");this.put("invitcOldDiscount", null);return this;};
	/** not .... */
	this.invitcOldDiscountNot=function(){if(this.proxy)return this.getProxy().invitcOldDiscountNot();this.put("invitcOldDiscountNot", "not");return this;};
	this.invitcOldDiscountNotNull=function(){if(this.proxy)return this.getProxy().invitcOldDiscountNotNull();this.put("invitcOldDiscountNot", "not");this.put("invitcOldDiscount", null);return this;};
	this.invitcOldDiscountNot=function(invitcOldDiscount){if(this.proxy)return this.getProxy().invitcOldDiscountNot(invitcOldDiscount);this.put("invitcOldDiscountNot", "not");this.put("invitcOldDiscount", invitcOldDiscount);return this;};
		
	/** and invitc_old_discount <= ? */
	this.invitcOldDiscountMin=function(min){if(this.proxy)return this.getProxy().invitcOldDiscountMin(min);this.put("invitcOldDiscountMin", min);return this;};
	/** and invitc_old_discount >= ? */
	this.invitcOldDiscountMax=function(max){if(this.proxy)return this.getProxy().invitcOldDiscountMax(max);this.put("invitcOldDiscountMax", max);return this;};
		
		 
	
	
	/** 老客推荐折扣        **/
	this.invitcOldTuiDiscount=function(invitcOldTuiDiscount){if(this.proxy)return this.getProxy().invitcOldTuiDiscount(invitcOldTuiDiscount);  this.put("invitcOldTuiDiscount", invitcOldTuiDiscount);return this;};
	/** and invitc_old_tui_discount is null */
	this.invitcOldTuiDiscountNull=function(){if(this.proxy)return this.getProxy().invitcOldTuiDiscountNull();if(this.get("invitcOldTuiDiscountNot")==null)this.put("invitcOldTuiDiscountNot", "");this.put("invitcOldTuiDiscount", null);return this;};
	/** not .... */
	this.invitcOldTuiDiscountNot=function(){if(this.proxy)return this.getProxy().invitcOldTuiDiscountNot();this.put("invitcOldTuiDiscountNot", "not");return this;};
	this.invitcOldTuiDiscountNotNull=function(){if(this.proxy)return this.getProxy().invitcOldTuiDiscountNotNull();this.put("invitcOldTuiDiscountNot", "not");this.put("invitcOldTuiDiscount", null);return this;};
	this.invitcOldTuiDiscountNot=function(invitcOldTuiDiscount){if(this.proxy)return this.getProxy().invitcOldTuiDiscountNot(invitcOldTuiDiscount);this.put("invitcOldTuiDiscountNot", "not");this.put("invitcOldTuiDiscount", invitcOldTuiDiscount);return this;};
		
	/** and invitc_old_tui_discount <= ? */
	this.invitcOldTuiDiscountMin=function(min){if(this.proxy)return this.getProxy().invitcOldTuiDiscountMin(min);this.put("invitcOldTuiDiscountMin", min);return this;};
	/** and invitc_old_tui_discount >= ? */
	this.invitcOldTuiDiscountMax=function(max){if(this.proxy)return this.getProxy().invitcOldTuiDiscountMax(max);this.put("invitcOldTuiDiscountMax", max);return this;};
		
		 
	
	
	/** 有效期截止日 [非空]       **/
	this.expiryDate=function(expiryDate){if(this.proxy)return this.getProxy().expiryDate(expiryDate);  this.put("expiryDate", expiryDate);return this;};
	/** and expiry_date is null */
	this.expiryDateNull=function(){if(this.proxy)return this.getProxy().expiryDateNull();if(this.get("expiryDateNot")==null)this.put("expiryDateNot", "");this.put("expiryDate", null);return this;};
	/** not .... */
	this.expiryDateNot=function(){if(this.proxy)return this.getProxy().expiryDateNot();this.put("expiryDateNot", "not");return this;};
	this.expiryDateNotNull=function(){if(this.proxy)return this.getProxy().expiryDateNotNull();this.put("expiryDateNot", "not");this.put("expiryDate", null);return this;};
	this.expiryDateNot=function(expiryDate){if(this.proxy)return this.getProxy().expiryDateNot(expiryDate);this.put("expiryDateNot", "not");this.put("expiryDate", expiryDate);return this;};
		
	/** and expiry_date >= ? */
	this.expiryDateStart=function(start){if(this.proxy)return this.getProxy().expiryDateStart(start);this.put("expiryDateStart", start);return this;};			
	/** and expiry_date <= ? */
	this.expiryDateEnd=function(end){if(this.proxy)return this.getProxy().expiryDateEnd(end);this.put("expiryDateEnd", end);return this;};
		
		 
	
	
	/** 分享周期 [非空]       **/
	this.invitcCycle=function(invitcCycle){if(this.proxy)return this.getProxy().invitcCycle(invitcCycle);  this.put("invitcCycle", invitcCycle);return this;};
	/** and invitc_cycle is null */
	this.invitcCycleNull=function(){if(this.proxy)return this.getProxy().invitcCycleNull();if(this.get("invitcCycleNot")==null)this.put("invitcCycleNot", "");this.put("invitcCycle", null);return this;};
	/** not .... */
	this.invitcCycleNot=function(){if(this.proxy)return this.getProxy().invitcCycleNot();this.put("invitcCycleNot", "not");return this;};
	this.invitcCycleNotNull=function(){if(this.proxy)return this.getProxy().invitcCycleNotNull();this.put("invitcCycleNot", "not");this.put("invitcCycle", null);return this;};
	this.invitcCycleNot=function(invitcCycle){if(this.proxy)return this.getProxy().invitcCycleNot(invitcCycle);this.put("invitcCycleNot", "not");this.put("invitcCycle", invitcCycle);return this;};
		
	/** and invitc_cycle <= ? */
	this.invitcCycleMin=function(min){if(this.proxy)return this.getProxy().invitcCycleMin(min);this.put("invitcCycleMin", min);return this;};
	/** and invitc_cycle >= ? */
	this.invitcCycleMax=function(max){if(this.proxy)return this.getProxy().invitcCycleMax(max);this.put("invitcCycleMax", max);return this;};
		
		
	this.invitcCycleIn=function(ids){
		if(this.proxy)return this.getProxy().invitcCycleIn(ids);  this.put("invitcCycleIn", ids);return this;
	};	
		 
	
	
	/** 微信分享标题        **/
	this.wechatTitle=function(wechatTitle){if(this.proxy)return this.getProxy().wechatTitle(wechatTitle);  this.put("wechatTitle", wechatTitle);return this;};
	/** and wechat_title is null */
	this.wechatTitleNull=function(){if(this.proxy)return this.getProxy().wechatTitleNull();if(this.get("wechatTitleNot")==null)this.put("wechatTitleNot", "");this.put("wechatTitle", null);return this;};
	/** not .... */
	this.wechatTitleNot=function(){if(this.proxy)return this.getProxy().wechatTitleNot();this.put("wechatTitleNot", "not");return this;};
	this.wechatTitleNotNull=function(){if(this.proxy)return this.getProxy().wechatTitleNotNull();this.put("wechatTitleNot", "not");this.put("wechatTitle", null);return this;};
	this.wechatTitleNot=function(wechatTitle){if(this.proxy)return this.getProxy().wechatTitleNot(wechatTitle);this.put("wechatTitleNot", "not");this.put("wechatTitle", wechatTitle);return this;};
		
		 
	
	
	/** 微信分享图片        **/
	this.wechatPic=function(wechatPic){if(this.proxy)return this.getProxy().wechatPic(wechatPic);  this.put("wechatPic", wechatPic);return this;};
	/** and wechat_pic is null */
	this.wechatPicNull=function(){if(this.proxy)return this.getProxy().wechatPicNull();if(this.get("wechatPicNot")==null)this.put("wechatPicNot", "");this.put("wechatPic", null);return this;};
	/** not .... */
	this.wechatPicNot=function(){if(this.proxy)return this.getProxy().wechatPicNot();this.put("wechatPicNot", "not");return this;};
	this.wechatPicNotNull=function(){if(this.proxy)return this.getProxy().wechatPicNotNull();this.put("wechatPicNot", "not");this.put("wechatPic", null);return this;};
	this.wechatPicNot=function(wechatPic){if(this.proxy)return this.getProxy().wechatPicNot(wechatPic);this.put("wechatPicNot", "not");this.put("wechatPic", wechatPic);return this;};
		
		 
	
	
	/** 是否投放 [非空]   0:不投放 1:投放     **/
	this.putIn=function(putIn){if(this.proxy)return this.getProxy().putIn(putIn);  this.put("putIn", putIn);return this;};
	/** and put_in is null */
	this.putInNull=function(){if(this.proxy)return this.getProxy().putInNull();if(this.get("putInNot")==null)this.put("putInNot", "");this.put("putIn", null);return this;};
	/** not .... */
	this.putInNot=function(){if(this.proxy)return this.getProxy().putInNot();this.put("putInNot", "not");return this;};
	this.putInNotNull=function(){if(this.proxy)return this.getProxy().putInNotNull();this.put("putInNot", "not");this.put("putIn", null);return this;};
	this.putInNot=function(putIn){if(this.proxy)return this.getProxy().putInNot(putIn);this.put("putInNot", "not");this.put("putIn", putIn);return this;};
		
		
	this.putInIn=function(ids){
		if(this.proxy)return this.getProxy().putInIn(ids);  this.put("putInIn", ids);return this;
	};	
		 
	
	
	/** 修改时间 [非空]       **/
	this.updateTime=function(updateTime){if(this.proxy)return this.getProxy().updateTime(updateTime);  this.put("updateTime", updateTime);return this;};
	/** and update_time is null */
	this.updateTimeNull=function(){if(this.proxy)return this.getProxy().updateTimeNull();if(this.get("updateTimeNot")==null)this.put("updateTimeNot", "");this.put("updateTime", null);return this;};
	/** not .... */
	this.updateTimeNot=function(){if(this.proxy)return this.getProxy().updateTimeNot();this.put("updateTimeNot", "not");return this;};
	this.updateTimeNotNull=function(){if(this.proxy)return this.getProxy().updateTimeNotNull();this.put("updateTimeNot", "not");this.put("updateTime", null);return this;};
	this.updateTimeNot=function(updateTime){if(this.proxy)return this.getProxy().updateTimeNot(updateTime);this.put("updateTimeNot", "not");this.put("updateTime", updateTime);return this;};
		
	/** and update_time >= ? */
	this.updateTimeStart=function(start){if(this.proxy)return this.getProxy().updateTimeStart(start);this.put("updateTimeStart", start);return this;};			
	/** and update_time <= ? */
	this.updateTimeEnd=function(end){if(this.proxy)return this.getProxy().updateTimeEnd(end);this.put("updateTimeEnd", end);return this;};
		
		 
	
	
	/** 添加时间 [非空]       **/
	this.addTime=function(addTime){if(this.proxy)return this.getProxy().addTime(addTime);  this.put("addTime", addTime);return this;};
	/** and add_time is null */
	this.addTimeNull=function(){if(this.proxy)return this.getProxy().addTimeNull();if(this.get("addTimeNot")==null)this.put("addTimeNot", "");this.put("addTime", null);return this;};
	/** not .... */
	this.addTimeNot=function(){if(this.proxy)return this.getProxy().addTimeNot();this.put("addTimeNot", "not");return this;};
	this.addTimeNotNull=function(){if(this.proxy)return this.getProxy().addTimeNotNull();this.put("addTimeNot", "not");this.put("addTime", null);return this;};
	this.addTimeNot=function(addTime){if(this.proxy)return this.getProxy().addTimeNot(addTime);this.put("addTimeNot", "not");this.put("addTime", addTime);return this;};
		
	/** and add_time >= ? */
	this.addTimeStart=function(start){if(this.proxy)return this.getProxy().addTimeStart(start);this.put("addTimeStart", start);return this;};			
	/** and add_time <= ? */
	this.addTimeEnd=function(end){if(this.proxy)return this.getProxy().addTimeEnd(end);this.put("addTimeEnd", end);return this;};
		
		 
	
	
	/** 状态 [非空]   1:正常 0:无效     **/
	this.status=function(status){if(this.proxy)return this.getProxy().status(status);  this.put("status", status);return this;};
	/** and status is null */
	this.statusNull=function(){if(this.proxy)return this.getProxy().statusNull();if(this.get("statusNot")==null)this.put("statusNot", "");this.put("status", null);return this;};
	/** not .... */
	this.statusNot=function(){if(this.proxy)return this.getProxy().statusNot();this.put("statusNot", "not");return this;};
	this.statusNotNull=function(){if(this.proxy)return this.getProxy().statusNotNull();this.put("statusNot", "not");this.put("status", null);return this;};
	this.statusNot=function(status){if(this.proxy)return this.getProxy().statusNot(status);this.put("statusNot", "not");this.put("status", status);return this;};
		
		
	this.statusIn=function(ids){
		if(this.proxy)return this.getProxy().statusIn(ids);  this.put("statusIn", ids);return this;
	};	
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有邀请优惠券 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/coupons/invitationcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取邀请优惠券分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/coupons/invitationcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取邀请优惠券 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/coupons/invitationcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

InvitCoupon.get = function(id){
	var protocol = ux.ajax("/admin/coupons/invitationcoupon.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.invitCoupon;
	return null;
}

InvitCoupon.where = new InvitCoupon.Where(0,true);